﻿<!DOCTYPE html>
<!--审批列表-->
<!--[by:wanglr]-->
<!--[date:2019-06-14]-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
    </style>
</head>
<body>
    <div id="app" v-cloak class="popupW50">
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                    <el-button type="primary" @click="onSubmit">{{col.btnSelect}}</el-button>
                </el-col>
            </el-row>
            <el-row>

                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.OperatingUnit" :placeholder="SecurityAndRiskConfirmationCard.OperatingUnit" size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.OperatingUnit+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.ProjectUnitLeader+mark.m}}
                                </template>
                                <treeselect v-model="formInline.model.ProjectUnitLeader" :options="ProjectUnitLeader" :flat="true"
                                            :show-count="true" :disable-branch-nodes="true" slot="suffix" placeholder="请选择"
                                            style="line-height: 28px;width: 54%;float: right;" />
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.ConfirmationCardNumber" :placeholder="SecurityAndRiskConfirmationCard.ConfirmationCardNumber" size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.ConfirmationCardNumber+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.SignStatus+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.SignStatus" slot="suffix" :placeholder="SecurityAndRiskConfirmationCard.SignStatus">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in SignStatus" :label="item.value" :value="item.key"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="6" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-date-picker v-model="formInline.ApplicationTime"
                                            type="daterange"
                                            size="mini"
                                            range-separator="至"
                                            start-placeholder="开始日期"
                                            end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.JobContent" :placeholder="SecurityAndRiskConfirmationCard.JobContent" size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.JobContent+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="6" :sm="6" :md="6" :lg="4" :xl="4">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{SecurityAndRiskConfirmationCard.JobPerson+mark.m}}
                                </template>
                                <treeselect v-model="formInline.model.JobPerson" :options="JobPerson" :flat="true"
                                            :show-count="true" :disable-branch-nodes="true" slot="suffix" placeholder="请选择"
                                            style="line-height: 28px;width: 54%;float: right;" />
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>
        <el-table ref="table" :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
                  @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
            <el-table-column type="selection" style=" padding-top: 0px;  padding-bottom: 0px;  " align="center" width="55" :reserve-selection="true">
            </el-table-column>
            <el-table-column prop="id"
                             :label="SecurityAndRiskConfirmationCard.id"
                             width="180">
                <template slot-scope="scope">
                    {{scope.row.id}}
                </template>
            </el-table-column>
            <el-table-column prop="OperatingUnit"
                             :label="SecurityAndRiskConfirmationCard.OperatingUnit">
            </el-table-column>
            <el-table-column prop="ConfirmationCardNumber"
                             :label="SecurityAndRiskConfirmationCard.ConfirmationCardNumber">
            </el-table-column>

            <el-table-column prop="ProjectUnitLeader"
                             width="140"
                             :formatter="getDicValue"
                             :label="SecurityAndRiskConfirmationCard.ProjectUnitLeader">
            </el-table-column>

            <el-table-column prop="JobTime"
                             :label="SecurityAndRiskConfirmationCard.JobTime">
            </el-table-column>

            <el-table-column prop="JobContent"
                             :label="SecurityAndRiskConfirmationCard.JobContent">
            </el-table-column>
            <el-table-column prop="JobPerson"
                             :formatter="getDicValue"
                             width="100"
                             :label="SecurityAndRiskConfirmationCard.JobPerson">
            </el-table-column>
            <el-table-column prop="SignStatus"
                             :formatter="getDicValue"
                             :label="SecurityAndRiskConfirmationCard.SignStatus">
            </el-table-column>
            <el-table-column width="53" prop="update" :label="col.btnSign" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                        <i class="el-icon-edit"></i>
                    </button>
                </template>
            </el-table-column>
        </el-table>
        <el-row type="flex" justify="end">
            <el-pagination ref="page" @size-change="handleSizeChange"
                           @current-change="handleCurrentChange"
                           :current-page="ListItem.currentPage"
                           :page-sizes="ListItem.pagesizes"
                           :page-size="ListItem.pagesize"
                           :layout="ListItem.layout"
                           :total="ListItem.total">
            </el-pagination>
        </el-row>
        <el-dialog title="高处作业安全许可证管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                   top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        Vue.component('treeselect', VueTreeselect.Treeselect)
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    mydata: PersonInChargeTree,
                    ListItem: ListItem,
                    ProjectUnitLeader: [],
                    JobPerson: [],
                    SignStatus: [{ key: "false", value: msg.UnSign }, { key: "true", value: msg.Signed }],
                    formInline: {
                        model: {
                            OperatingUnit: '',//作业单位
                            ProjectUnitLeader: null,//项目单位负责人
                            ConfirmationCardNumber: '',//确认卡编号
                            JobTime: '',//"作业时间",
                            JobContent: '',//作业内容
                            JobPerson: null,//作业人员
                            SignStatus: ''//签字状态
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            },
            created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {

                this.ProjectUnitLeader = fn(this.mydata, "0");
                this.JobPerson = fn(this.mydata, "0");
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleNodeClick: function (data) {
                    console.log(data);
                },
                getDicValue: function (row, column, cellValue, index) {
                    switch (column.property) {
                        case "ProjectUnitLeader":
                            return getTreeValue(this.mydata, cellValue);
                            break;
                        case "JobPerson":
                            return getTreeValue(this.mydata, cellValue);
                            break;
                        case "SignStatus":
                            return cellValue == "true" || cellValue == true ? msg.Signed : msg.UnSign;
                        default:
                            return cellValue; break;
                    }

                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/SecurityAndRiskConfirmationCard/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "SecurityAndRiskConfirmationCardInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/SecurityAndRiskConfirmationCard/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); }
            }
        });

    </script>
</body>

</html>